home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 January / EnterCD 01_2004.iso / Multimedia / Advanced Effect Maker Freeware Edition 1.0 / aemf10.exe / {app} / templates / barchart.swf / scripts / frame_4 / DoAction.as
Encoding:
Text File  |  2003-09-20  |  3.7 KB  |  197 lines

  1. debug = 0;
  2. var movx = parseInt("320",10);
  3. var movy = parseInt("240",10);
  4. if(texts == null)
  5. {
  6.    var texts = "This|is|Bar|Chart|";
  7. }
  8. if(vals == null)
  9. {
  10.    var vals = "100|40|-20|140|";
  11. }
  12. if(c1 == null)
  13. {
  14.    var c1 = parseInt("16711680",10);
  15. }
  16. else
  17. {
  18.    c1 = parseInt(c1,16);
  19. }
  20. if(c2 == null)
  21. {
  22.    var c2 = parseInt("65280",10);
  23. }
  24. else
  25. {
  26.    c2 = parseInt(c2,16);
  27. }
  28. if(c3 == null)
  29. {
  30.    var c3 = parseInt("255",10);
  31. }
  32. else
  33. {
  34.    c3 = parseInt(c3,16);
  35. }
  36. if(bgc == null)
  37. {
  38.    var bgc = parseInt("16777215",10);
  39. }
  40. else
  41. {
  42.    bgc = parseInt(bgc,16);
  43. }
  44. if(tpause == null)
  45. {
  46.    var tpause = parseInt("300",10);
  47. }
  48. else
  49. {
  50.    tpause = parseInt(tpause,10);
  51. }
  52. if(ty == null)
  53. {
  54.    var ty = parseInt("20",10);
  55. }
  56. else
  57. {
  58.    ty = parseInt(ty,10);
  59. }
  60. if(by == null)
  61. {
  62.    var by = parseInt("20",10);
  63. }
  64. else
  65. {
  66.    by = parseInt(by,10);
  67. }
  68. if(lx == null)
  69. {
  70.    var lx = parseInt("20",10);
  71. }
  72. else
  73. {
  74.    lx = parseInt(lx,10);
  75. }
  76. if(rx == null)
  77. {
  78.    var rx = parseInt("20",10);
  79. }
  80. else
  81. {
  82.    rx = parseInt(rx,10);
  83. }
  84. var target = "";
  85. var sbg = parseInt("0",10);
  86. var lm = " |";
  87. var lmxy = " |";
  88. ii = 0;
  89. if(0 < sbg)
  90. {
  91.    moviearea.bgrholder.attachMovie("plain_bgr","pbg",0);
  92.    setProperty("moviearea.bgrholder.pbg", _X, 0);
  93.    setProperty("moviearea.bgrholder.pbg", _Y, 0);
  94.    setProperty("moviearea.bgrholder.pbg", _width, movx);
  95.    setProperty("moviearea.bgrholder.pbg", _height, movy);
  96.    mc = new Color("moviearea.bgrholder.pbg");
  97.    mc.setRGB(bgc);
  98. }
  99. moviearea._x = 0;
  100. moviearea.bimage._width = movx;
  101. moviearea._y = 0;
  102. moviearea.bimage._height = movy;
  103. var texts = texts.split("|");
  104. var vals = vals.split("|");
  105. tpause = int(tpause * 12 / 100);
  106. mp = 0;
  107. t2 = tpause / 2;
  108. attachMovie("click","click",0);
  109. setProperty("click", _X, 0);
  110. setProperty("click", _Y, 0);
  111. setProperty("click", _width, movx);
  112. setProperty("click", _height, movy);
  113. var lm = lm.split("|");
  114. var lmxy = lmxy.split("|");
  115. i = 0;
  116. while(i < lm.length)
  117. {
  118.    if(3 < lm[i].length)
  119.    {
  120.       attachMovie("lom","lm" add i,i + 1);
  121.       var xy = lmxy[i].split(",");
  122.       setProperty("lm" add i, _X, xy[0]);
  123.       setProperty("lm" add i, _Y, xy[1]);
  124.       eval("lm" add i).loadMovie(lm[i]);
  125.    }
  126.    i++;
  127. }
  128. p100 = 0;
  129. min = 9999999;
  130. max = -9999999;
  131. i = 0;
  132. while(i < texts.length)
  133. {
  134.    if(texts[i] ne "")
  135.    {
  136.       vals[i] = Number(vals[i]);
  137.       attachMovie("shape","t" add i,(i + 1) * 3 + lm.length);
  138.       setProperty("t" add i, _visible, false);
  139.       attachMovie("grr",i,i * 3 + 1 + lm.length);
  140.       setProperty(i, _visible, false);
  141.       mc = new Color("t" add i);
  142.       mc.setRGB(c1);
  143.       set("t" add i add ".text.text",texts[i] add " (" add vals[i] add ")");
  144.       if(max < vals[i])
  145.       {
  146.          max = vals[i];
  147.       }
  148.       if(vals[i] < min)
  149.       {
  150.          min = vals[i];
  151.       }
  152.       ii++;
  153.    }
  154.    i++;
  155. }
  156. if(max >= 0)
  157. {
  158.    p100 = max;
  159. }
  160. else
  161. {
  162.    p100 = 0;
  163. }
  164. if(0 < min)
  165. {
  166.    min = 0;
  167. }
  168. if(min < 0)
  169. {
  170.    p100 += Math.abs(min);
  171. }
  172. th = getProperty("t0", _height);
  173. wi = int(movx - lx - rx);
  174. hi = int(movy - ty - by);
  175. ww = wi / ii;
  176. var r1 = c2 >> 16 & 0xFF;
  177. var g1 = c2 >> 8 & 0xFF;
  178. var b1 = c2 & 0xFF;
  179. var r2 = c3 >> 16 & 0xFF;
  180. var g2 = c3 >> 8 & 0xFF;
  181. var b2 = c3 & 0xFF;
  182. i = 0;
  183. while(i < ii)
  184. {
  185.    alpha = i * 100 / (ii - 1);
  186.    var mix = (Math.floor(r1 * alpha / 100) + Math.floor(r2 * (100 - alpha) / 100) << 16) + (Math.floor(g1 * alpha / 100) + Math.floor(g2 * (100 - alpha) / 100) << 8) + (Math.floor(b1 * alpha / 100) + Math.floor(b2 * (100 - alpha) / 100));
  187.    mc = new Color(i);
  188.    mc.setRGB(mix);
  189.    i++;
  190. }
  191. mode = 0;
  192. var today = new Date();
  193. if(!(today.getTime() < ts && ts < today.getTime() + 172800000 || ts == -1 || 0 < debug))
  194. {
  195.    gotoAndStop("ea");
  196. }
  197.